package com.front.teacher.teacherapp.base;

import android.os.Bundle;

/**
 * 有数据的MVP基类activity
 */

public abstract class BaseMvpActivity<IV, P extends BasePresenter<IV>> extends BaseActivity {
    public P presenter;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        presenter = initPresenter();
        presenter.attachView((IV) this);
        super.onCreate(savedInstanceState);
    }

    public abstract P initPresenter();

    @Override
    protected void onDestroy() {
        super.onDestroy();
        if (presenter != null) {
            presenter.detachView();
            presenter = null;
        }
    }


}
